package com.huaqing.manage.service.impl;

import java.util.List;
import com.huaqing.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huaqing.manage.mapper.DishCategoryMapper;
import com.huaqing.manage.domain.DishCategory;
import com.huaqing.manage.service.IDishCategoryService;

/**
 * 菜品分类Service业务层处理
 * 
 * @author cdutTang
 * @date 2025-02-28
 */
@Service
public class DishCategoryServiceImpl implements IDishCategoryService 
{
    @Autowired
    private DishCategoryMapper dishCategoryMapper;

    /**
     * 查询菜品分类
     * 
     * @param categoryId 菜品分类主键
     * @return 菜品分类
     */
    @Override
    public DishCategory selectDishCategoryByCategoryId(Long categoryId)
    {
        return dishCategoryMapper.selectDishCategoryByCategoryId(categoryId);
    }

    /**
     * 查询菜品分类列表
     * 
     * @param dishCategory 菜品分类
     * @return 菜品分类
     */
    @Override
    public List<DishCategory> selectDishCategoryList(DishCategory dishCategory)
    {
        return dishCategoryMapper.selectDishCategoryList(dishCategory);
    }

    /**
     * 新增菜品分类
     * 
     * @param dishCategory 菜品分类
     * @return 结果
     */
    @Override
    public int insertDishCategory(DishCategory dishCategory)
    {
        dishCategory.setCreateTime(DateUtils.getNowDate());
        return dishCategoryMapper.insertDishCategory(dishCategory);
    }

    /**
     * 修改菜品分类
     * 
     * @param dishCategory 菜品分类
     * @return 结果
     */
    @Override
    public int updateDishCategory(DishCategory dishCategory)
    {
        return dishCategoryMapper.updateDishCategory(dishCategory);
    }

    /**
     * 批量删除菜品分类
     * 
     * @param categoryIds 需要删除的菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteDishCategoryByCategoryIds(Long[] categoryIds)
    {
        return dishCategoryMapper.deleteDishCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除菜品分类信息
     * 
     * @param categoryId 菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteDishCategoryByCategoryId(Long categoryId)
    {
        return dishCategoryMapper.deleteDishCategoryByCategoryId(categoryId);
    }
}
